//
//  ViewController.m
//  ZCStudyDemo
//
//  Created by XFB on 2018/8/14.
//  Copyright © 2018年 ZhouCheng. All rights reserved.
//

#import "ViewController.h"
#import "UIImage+Compress.h"
#import "AdScrollView.h"

@interface ViewController ()

@property (nonatomic, strong) AdScrollView *adScrollView;

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.adScrollView = [[AdScrollView alloc] initWithFrame:CGRectMake(0, 200, ScreenWidth, 100)];
    self.adScrollView.backgroundColor = [UIColor whiteColor];
    self.adScrollView.modelArray = @[
                                     @{@"avatar":@"001",
                                       @"name":@"秋名山车神",
                                       @"time":@"1分钟前",
                                       @"content":@"真的感谢消费保替我们消费者解决事实，赞！",
                                       },
                                     @{@"avatar":@"002",
                                       @"name":@"A big diao boy",
                                       @"time":@"30分钟前",
                                       @"content":@"消费保真的很有保障，商家已经帮我退款了。。。",},
                                     @{@"avatar":@"003",
                                       @"name":@"Davy",
                                       @"time":@"1个小时前",
                                       @"content":@"天猫还没有给我解决的问题，还是消费保靠谱，已经完成了！",},
                                     @{@"avatar":@"002",
                                       @"name":@"A big diao boy",
                                       @"time":@"30分钟前",
                                       @"content":@"消费保真的很有保障，商家已经帮我退款了。。。",},
                                     @{@"avatar":@"003",
                                       @"name":@"Davy",
                                       @"time":@"1个小时前",
                                       @"content":@"天猫还没有给我解决的问题，还是消费保靠谱，已经完成了！",},
                                     ];
    
    [self.view addSubview:self.adScrollView];
    
    /**
     1.数组越界
     Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndexedSubscript:]: index 3 beyond bounds [0 .. 1]'
     */
//    NSArray *array = @[@"1", @"2"];
//    NSLog(@"%@", array[3]);
    
    /**
     2.使用nil做初始化操作 一般出现在接口参数字典 需之前做好空判断
     Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
     */
//    NSString *string = nil;
//    NSDictionary *dict = @{@"name": string};
//    NSLog(@"%@", dict);
    
    /**
     3.向数组中插入空对象
     Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
     */
//    NSString *string2 = nil;
//    NSMutableArray *mutableArray = [NSMutableArray array];
//    [mutableArray addObject:string2];
//    NSLog(@"%@", mutableArray);
    
    /**
     4.NSRange访问越界
     Terminating app due to uncaught exception 'NSRangeException', reason: '-[__NSCFConstantString substringWithRange:]: Range {5, 10} out of bounds; string length 6'
     */
//    NSString *string1 = @"323232";
//    NSRange range = NSMakeRange(5, 10);
//    [string1 substringWithRange:range];
    
    /// 5.低版本调用了搞版本API

}

@end
